package org.quasar.airNova.presentationLayer;

import java.awt.BorderLayout;
import java.awt.Font;
import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;

import javax.swing.JButton;
import javax.swing.JLabel;
import javax.swing.JPanel;
import javax.swing.JTextField;

public class ApagarCliente extends JPanel {

	private JTextField nClienteJTF;
	private Gui gui;
	
	/**
	 * Create the panel.
	 */
	public ApagarCliente(Gui gui) {
		this.setGui(gui);
		setLayout(new BorderLayout(0, 0));
		this.setSize(500, 350);
		JPanel panel = new JPanel();
		add(panel, BorderLayout.CENTER);
		panel.setLayout(null);
		
		JLabel lblNewLabel = new JLabel("N\u00FAmero de Cliente");
		lblNewLabel.setBounds(40, 76, 151, 14);
		panel.add(lblNewLabel);
		
		nClienteJTF = new JTextField();
		nClienteJTF.setBounds(231, 70, 203, 20);
		panel.add(nClienteJTF);
		nClienteJTF.setColumns(10);
		
		JButton btnNewButton_2 = new JButton("Apagar Campos");
		btnNewButton_2.addActionListener(new ActionListener() {
			public void actionPerformed(ActionEvent arg0) {
				nClienteJTF.setText("");
			}
		});
		btnNewButton_2.setBounds(251, 217, 126, 23);
		panel.add(btnNewButton_2);
		
		JButton btnNewButton = new JButton("Submeter");
		btnNewButton.addActionListener(new ActionListener() {
			public void actionPerformed(ActionEvent arg0) {
				if(nClienteJTF.getText().length() != 0)
				AirNova_Database.apagarCliente(nClienteJTF.getText());
			}
		});
		btnNewButton.setBounds(44, 217, 98, 23);
		panel.add(btnNewButton);
		
		JButton btnNewButton_1 = new JButton("Cancelar");
		btnNewButton_1.addActionListener(new ActionListener() {
			public void actionPerformed(ActionEvent e) {
				getGui().getTabbedPane().removeTabAt(getGui().getTabbedPane().getSelectedIndex());
			}
		});
		btnNewButton_1.setBounds(152, 217, 89, 23);
		panel.add(btnNewButton_1);
		
		JLabel lblNewLabel_3 = new JLabel("Apagar Cliente");
		lblNewLabel_3.setFont(new Font("Tahoma", Font.PLAIN, 17));
		lblNewLabel_3.setBounds(30, 24, 129, 32);
		panel.add(lblNewLabel_3);
	}

	public Gui getGui() {
		return gui;
	}

	public void setGui(Gui gui) {
		this.gui = gui;
	}
}
